package com.papper.common.enums;

/**
 * @Author:Lajiao
 * @Date:2014年7月14日
 * @Time:下午3:49:44
 * @Description:三方收款码
 */
public enum QrcodeTypeEnum {
    LKL("LKL", "拉卡拉收款码"),
    HIUFU("HIUFU", "汇付收款码"),
    UMS("UMS", "银联商务收款码"),
    SQW("SQW", "收钱蛙收款码"),
    YSF("YSF", "云闪付商家码"),
    ZSM("ZSM", "微信赞赏码");

    private String code;
    private String name;

    QrcodeTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getName(String code) {
        if (code == null) {
            return "";
        }
        for (QrcodeTypeEnum re : QrcodeTypeEnum.values()) {
            if (re.getCode().toString().equals(code)) {
                return re.getName();
            }
        }
        return "";
    }

    public static String getCode(String name) {
        if (name == null) {
            return null;
        }
        for (QrcodeTypeEnum re : QrcodeTypeEnum.values()) {
            if (name.equals(re.getName())) {
                return re.getCode();
            }
        }
        return null;
    }
}
